igo8.cc gopal.cc humminbird.cc mapasia.cc gnav_trl.cc navitel.cc ggv_ovl.cc
jtr.cc sbp.cc sbn.cc mmo.cc skyforce.cc itracku.cc v900.cc
pocketfms_bc.cc pocketfms_fp.cc pocketfms_wp.cc enigma.cc
- vpl.cc teletype.cc jogmap.cc bushnell.cc bushnell_trl.cc wintec_tes.cc
+ vpl.cc teletype.cc jogmap.cc wintec_tes.cc
subrip.cc garmin_xt.cc garmin_fit.cc
mtk_locus.cc googledir.cc mapbar_track.cc mapfactor.cc f90g_track.cc
energympro.cc mynav.cc ggv_bin.cc globalsat_sport.cc geojson.cc qstarz_bl_1000.cc
igo8.cc gopal.cc humminbird.cc mapasia.cc gnav_trl.cc navitel.cc ggv_ovl.cc \
jtr.cc sbp.cc sbn.cc mmo.cc skyforce.cc itracku.cc v900.cc \
pocketfms_bc.cc pocketfms_fp.cc pocketfms_wp.cc enigma.cc \
- vpl.cc teletype.cc jogmap.cc bushnell.cc bushnell_trl.cc wintec_tes.cc \
+ vpl.cc teletype.cc jogmap.cc wintec_tes.cc \
subrip.cc garmin_xt.cc garmin_fit.cc \
mtk_locus.cc googledir.cc mapbar_track.cc mapfactor.cc f90g_track.cc \
energympro.cc mynav.cc ggv_bin.cc globalsat_sport.cc geojson.cc qstarz_bl_1000.cc
+++ /dev/null
-/*
- Read and write Bushnell files.
-
- Copyright (C) 2008, 2009 Robert Lipe (robertlipe+source@gpsbabel.org)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
- */
-
-
-#include "defs.h"
-#include <QtCore/QFileInfo>
-#include <cmath>
-#define MYNAME "Bushnell"
-
-static gbfile* file_in;
-static QString ofname;
-static short_handle mkshort_handle = nullptr;
-
-static
-QVector<arglist_t> bushnell_args = {
-};
-
-// Apparently, the icons are undocumented, so we made up names,
-// preferring them to be consistent with other brands where possible.
-
-struct bushnell_icon_mapping_t {
- signed int symbol;
- const char* icon;
-};
-
-static const bushnell_icon_mapping_t bushnell_icons[] = {
- { 0x00, "Yellow Square"},
- { 0x01, "Blue Grey Circle" },
- { 0x02, "Yellow Diamond" },
- { 0x03, "Blue Asterisk" },
- { 0x04, "Blue Bulls Eye pointing NE" },
- { 0x05, "Red =O= on a 45 degree." },
- { 0x06, "House" },
- { 0x06, "Residence" },
- { 0x07, "Lodging" },
- { 0x08, "Hospital" },
- { 0x09, "Auto Repair" },
- { 0x09, "Car Repair" },
- { 0x0a, "Tools" },
- { 0x0b, "Gas" },
- { 0x0c, "Hiking" },
- { 0x0d, "Camping" },
- { 0x0e, "Picnic Area" },
- { 0x0f, "Deer Stand" },
- { 0x10, "Deer" },
- { 0x11, "Park" },
- { 0x11, "Tree" },
- { 0x12, "Highway Exit" },
- { 0x13, "Fjord"}, // Looks like a road narrows.
- { 0x14, "Bridge" },
- { 0x15, "Waypoint" }, // or golf hole/flag
- { 0x16, "Warning" }, // Caution Triangle with ! in it.
- { 0x17, "Bicycle" },
-
- { 0x18, "Blue Circle" }, // ? in it, undocumented icon.
- { 0x19, "Blue Diamond Checkmark" }, // undocumented.
-
- { 0x1a, "Camera" },
- { 0x1b, "Restaurant" }, // "Fork/Knife (meal place?)"
- { 0x1c, "Restroom" }, // (man & Woman icon)"
- { 0x1d, "RV Park" }, // "Bus or RV (RV campground?)"
- { 0x1e, "Potable Water" }, // (faucet/glass or bucket)"
- { 0x1f, "Fishing" },
- { 0x20, "Anchor in square" },
- { 0x21, "Boat ramp/launch" },
- { 0x22, "Anchor" },
- { 0x23, "Buoy" },
- { 0x24, "Man Overboard?" },
- { 0x25, "Snow Skiing" },
- { 0x26, "Mountain/Mountain Peak" },
- { 0x27, "Turkey Tracks/animal tracks" },
-
- { 0x28, "Bank" }, // "Cash (ATM Maybe)"
- { 0x29, "Bar" }, // "Martini undocumented"
- { 0x2a, "Lighthouse" },
-
- { 0x2b, "Tent" },
-
- { 0x2c, "Crescent Wrench or can opener" },
-
- { 0x2d, "School" }, //? White Building with tunnel looking door and flag on top."
- { 0x2f, "Information" }, // "i (info/internet maybe?)"
- { 0x30, "Picnic" }, //"Picnic table & Tree, maybe forest picnic or day use area?"
- { 0x31, "Phone" },
- { 0x32, "Letter/Envelope" },
- { 0x33, "Forest/Park Ranger" },
- { 0x34, "Fire department" }, //? Red Square building with yellow flag."
-
- { 0x35, "Shopping" },
- { 0x36, "Looks like Cross+hurricane symbol, strange also undocumented." },
-
- { 0x37, "Tunnel" },
- { 0x38, "Mountain/Summit" },
-
- { 0x39, "Square split diagonally with lines between... magnet maybe? undocumented" },
-
- { 0x3a, "Swimmer/swimming" },
- { 0x3b, "Officer? Looks like man leaned over holding blue cube..." },
- { 0x3c, "Parking" }, //"Car Parked"
- { 0x3d, "Airport" },
- { 0x3e, "Bus Terminal" }, // (guess) Looks like Bus under canopy."
- { 0x3f, "Red Cross" },
- { 0x40, "Red Building with flag, Fire Station maybe." },
- { 0x41, "Bus" },
- { 0x42, "Officer" }, // "see 3b: duplicate"
- { 0x43, "Railroad" },
- { 0x44, "Auto Ferry" },
- {-1, nullptr}
-};
-
-static unsigned int
-bushnell_get_icon_from_name(QString name)
-{
- if (name.isNull()) {
- name = "Waypoint";
- }
-
- for (const bushnell_icon_mapping_t* t = bushnell_icons; t->icon != nullptr; t++) {
- if (0 == name.compare(t->icon, Qt::CaseInsensitive)) {
- return t->symbol;
- }
- }
- return 0;
-}
-
-static const char*
-bushnell_get_name_from_symbol(signed int s)
-{
- for (const bushnell_icon_mapping_t* t = bushnell_icons; t->icon != nullptr; t++) {
- if (s == t->symbol) {
- return t->icon;
- }
- }
- return "Waypoint";
-}
-
-static void
-rd_init(const QString& fname)
-{
- file_in = gbfopen_le(fname, "rb", MYNAME);
-}
-
-static void
-rd_deinit()
-{
- gbfclose(file_in);
-}
-
-static void
-wr_init(const QString& fname)
-{
- static char valid_chars [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789"
- ".-/\\~@#$%^&*()_+=<>"
- "abcdefghijklmnopqrstuvwxyz";
-
- // If user provided an extension in the pathname, whack it.
- ofname = fname;
- int suffix_len = QFileInfo(fname).suffix().length();
- if (suffix_len > 0) {
- /* drop the suffix and the period */
- ofname.chop(suffix_len + 1);
- }
-
- mkshort_handle = mkshort_new_handle();
- setshort_length(mkshort_handle, 19);
- setshort_goodchars(mkshort_handle, valid_chars);
-}
-
-static void
-wr_deinit()
-{
- mkshort_del_handle(&mkshort_handle);
- ofname.clear();
-}
-
-/*
- * Each file contains a single waypoint.
- */
-static void
-bushnell_read()
-{
- auto* wpt_tmp = new Waypoint;
-
- int32_t lat_tmp = gbfgetint32(file_in);
- int32_t lon_tmp = gbfgetint32(file_in);
-
- unsigned int icon = gbfgetc(file_in);
- wpt_tmp->icon_descr = bushnell_get_name_from_symbol(icon);
- unsigned int proximity = gbfgetc(file_in); // 1 = off, 3 = proximity alarm.
- (void) proximity;
- wpt_tmp->latitude = lat_tmp / 10000000.0;
- wpt_tmp->longitude = lon_tmp / 10000000.0;
-
- // Apparently this is always zero terminated, though it's never been
- // observed to be longer than 19 bytes + a null terminator.
- wpt_tmp->shortname = gbfgetstr(file_in);
-
- waypt_add(wpt_tmp);
-}
-
-static void
-bushnell_write_one(const Waypoint* wpt)
-{
- char tbuf[20]; // 19 text bytes + null terminator.
- char padding[2] = {0, 0};
- static int wpt_count;
- QString fname(ofname);
- fname += "-";
- fname += QString::number(wpt_count++);
- fname += ".wpt";
-
- gbfile* file_out = gbfopen_le(fname, "wb", MYNAME);
- gbfputint32(round(wpt->latitude * 10000000), file_out);
- gbfputint32(round(wpt->longitude * 10000000), file_out);
- gbfputc(bushnell_get_icon_from_name(wpt->icon_descr), file_out);
- gbfputc(0x01, file_out); // Proximity alarm. 1 == "off", 3 == armed.
-
- strncpy(tbuf, CSTRc(wpt->shortname), sizeof(tbuf) - 1);
- tbuf[sizeof(tbuf)-1] = 0;
- gbfwrite(tbuf, sizeof(tbuf), 1, file_out);
-
- // two padding bytes follow name.
- gbfwrite(padding, sizeof(padding), 1, file_out);
-
- gbfclose(file_out);
-}
-
-static void
-bushnell_write()
-{
- waypt_disp_all(bushnell_write_one);
-}
-
-ff_vecs_t bushnell_vecs = {
- ff_type_file,
- FF_CAP_RW_WPT,
- rd_init,
- wr_init,
- rd_deinit,
- wr_deinit,
- bushnell_read,
- bushnell_write,
- nullptr,
- &bushnell_args,
- CET_CHARSET_MS_ANSI, 0, /* Not really sure... */
- NULL_POS_OPS,
- nullptr
-};
+++ /dev/null
-/*
- Read and write Bushnell trail *.trl files.
-
- Copyright (C) 2009 Robert Lipe (robertlipe+source@gpsbabel.org)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
- */
-
-
-#include "defs.h"
-#define MYNAME "Bushnell Trail"
-
-static gbfile* file_in;
-static gbfile* file_out;
-static int trkpt_count;
-static route_head* trk_head;
-
-static
-QVector<arglist_t> bushnell_args = {
-};
-
-static void
-rd_init(const QString& fname)
-{
- char h[0x14]; // Believed to be zero terminated.
- file_in = gbfopen_le(fname, "rb", MYNAME);
- gbfread(h, 1, sizeof(h), file_in);
-
- trk_head = new route_head;
- track_add_head(trk_head);
-
- trk_head->rte_name = lrtrim(h);
-}
-
-static void
-rd_deinit()
-{
- gbfclose(file_in);
-}
-
-static void
-wr_init(const QString& fname)
-{
- int l = fname.length();
- char obuf[20] = { 0 } ;
- char* p = obuf;
- file_out = gbfopen_le(fname, "w", MYNAME);
- trkpt_count = 0;
- QString fnameu = fname.toUpper();
- for (int i = 0; (i < l) && (i < 20); i++) {
- char c = fnameu[i].toLatin1();
- if (isalnum(c)) {
- *p++ = c;
- }
- if (c == '.') {
- break;
- }
- }
- gbfwrite(&obuf, 1, 20, file_out);
-}
-
-static void
-wr_deinit()
-{
- int i = trkpt_count;
- while (i < 4502) {
- gbfputint32(0, file_out);
- gbfputint32(0, file_out);
- i++;
- }
- gbfputint32(0, file_out);
- gbfputint16(trkpt_count, file_out);
- gbfputc(1, file_out);
-
- gbfclose(file_out);
-}
-
-/*
- * Each file contains a single waypoint.
- */
-static void
-bushnell_read()
-{
- while (true) {
- int lat_tmp = gbfgetint32(file_in);
- int lon_tmp = gbfgetint32(file_in);
-
- if (!lat_tmp && !lon_tmp) {
- break;
- }
-
- auto* wpt_tmp = new Waypoint;
- wpt_tmp->latitude = lat_tmp / 10000000.0;
- wpt_tmp->longitude = lon_tmp / 10000000.0;
-
- track_add_wpt(trk_head, wpt_tmp);
- }
-}
-
-static void
-bushnell_write_one(const Waypoint* wpt)
-{
- int32_t lat = wpt->latitude * 10000000.0;
- int32_t lon = wpt->longitude * 10000000.0;
- trkpt_count++;
- if (trkpt_count > 4502) {
- fatal(MYNAME " too many trackpoints. Max is 4502.");
- }
-
- gbfputint32(lat, file_out);
- gbfputint32(lon, file_out);
-}
-
-static void
-bushnell_write()
-{
- track_disp_all(nullptr, nullptr, bushnell_write_one);
-}
-
-ff_vecs_t bushnell_trl_vecs = {
- ff_type_file,
- { ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none },
- rd_init,
- wr_init,
- rd_deinit,
- wr_deinit,
- bushnell_read,
- bushnell_write,
- nullptr,
- &bushnell_args,
- CET_CHARSET_MS_ANSI, 0, /* Not really sure... */
- NULL_POS_OPS,
- nullptr
-};
--- /dev/null
+/*
+ Read and write Bushnell files.
+
+ Copyright (C) 2008, 2009 Robert Lipe (robertlipe+source@gpsbabel.org)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ */
+
+
+#include "defs.h"
+#include <QtCore/QFileInfo>
+#include <cmath>
+#define MYNAME "Bushnell"
+
+static gbfile* file_in;
+static QString ofname;
+static short_handle mkshort_handle = nullptr;
+
+static
+QVector<arglist_t> bushnell_args = {
+};
+
+// Apparently, the icons are undocumented, so we made up names,
+// preferring them to be consistent with other brands where possible.
+
+struct bushnell_icon_mapping_t {
+ signed int symbol;
+ const char* icon;
+};
+
+static const bushnell_icon_mapping_t bushnell_icons[] = {
+ { 0x00, "Yellow Square"},
+ { 0x01, "Blue Grey Circle" },
+ { 0x02, "Yellow Diamond" },
+ { 0x03, "Blue Asterisk" },
+ { 0x04, "Blue Bulls Eye pointing NE" },
+ { 0x05, "Red =O= on a 45 degree." },
+ { 0x06, "House" },
+ { 0x06, "Residence" },
+ { 0x07, "Lodging" },
+ { 0x08, "Hospital" },
+ { 0x09, "Auto Repair" },
+ { 0x09, "Car Repair" },
+ { 0x0a, "Tools" },
+ { 0x0b, "Gas" },
+ { 0x0c, "Hiking" },
+ { 0x0d, "Camping" },
+ { 0x0e, "Picnic Area" },
+ { 0x0f, "Deer Stand" },
+ { 0x10, "Deer" },
+ { 0x11, "Park" },
+ { 0x11, "Tree" },
+ { 0x12, "Highway Exit" },
+ { 0x13, "Fjord"}, // Looks like a road narrows.
+ { 0x14, "Bridge" },
+ { 0x15, "Waypoint" }, // or golf hole/flag
+ { 0x16, "Warning" }, // Caution Triangle with ! in it.
+ { 0x17, "Bicycle" },
+
+ { 0x18, "Blue Circle" }, // ? in it, undocumented icon.
+ { 0x19, "Blue Diamond Checkmark" }, // undocumented.
+
+ { 0x1a, "Camera" },
+ { 0x1b, "Restaurant" }, // "Fork/Knife (meal place?)"
+ { 0x1c, "Restroom" }, // (man & Woman icon)"
+ { 0x1d, "RV Park" }, // "Bus or RV (RV campground?)"
+ { 0x1e, "Potable Water" }, // (faucet/glass or bucket)"
+ { 0x1f, "Fishing" },
+ { 0x20, "Anchor in square" },
+ { 0x21, "Boat ramp/launch" },
+ { 0x22, "Anchor" },
+ { 0x23, "Buoy" },
+ { 0x24, "Man Overboard?" },
+ { 0x25, "Snow Skiing" },
+ { 0x26, "Mountain/Mountain Peak" },
+ { 0x27, "Turkey Tracks/animal tracks" },
+
+ { 0x28, "Bank" }, // "Cash (ATM Maybe)"
+ { 0x29, "Bar" }, // "Martini undocumented"
+ { 0x2a, "Lighthouse" },
+
+ { 0x2b, "Tent" },
+
+ { 0x2c, "Crescent Wrench or can opener" },
+
+ { 0x2d, "School" }, //? White Building with tunnel looking door and flag on top."
+ { 0x2f, "Information" }, // "i (info/internet maybe?)"
+ { 0x30, "Picnic" }, //"Picnic table & Tree, maybe forest picnic or day use area?"
+ { 0x31, "Phone" },
+ { 0x32, "Letter/Envelope" },
+ { 0x33, "Forest/Park Ranger" },
+ { 0x34, "Fire department" }, //? Red Square building with yellow flag."
+
+ { 0x35, "Shopping" },
+ { 0x36, "Looks like Cross+hurricane symbol, strange also undocumented." },
+
+ { 0x37, "Tunnel" },
+ { 0x38, "Mountain/Summit" },
+
+ { 0x39, "Square split diagonally with lines between... magnet maybe? undocumented" },
+
+ { 0x3a, "Swimmer/swimming" },
+ { 0x3b, "Officer? Looks like man leaned over holding blue cube..." },
+ { 0x3c, "Parking" }, //"Car Parked"
+ { 0x3d, "Airport" },
+ { 0x3e, "Bus Terminal" }, // (guess) Looks like Bus under canopy."
+ { 0x3f, "Red Cross" },
+ { 0x40, "Red Building with flag, Fire Station maybe." },
+ { 0x41, "Bus" },
+ { 0x42, "Officer" }, // "see 3b: duplicate"
+ { 0x43, "Railroad" },
+ { 0x44, "Auto Ferry" },
+ {-1, nullptr}
+};
+
+static unsigned int
+bushnell_get_icon_from_name(QString name)
+{
+ if (name.isNull()) {
+ name = "Waypoint";
+ }
+
+ for (const bushnell_icon_mapping_t* t = bushnell_icons; t->icon != nullptr; t++) {
+ if (0 == name.compare(t->icon, Qt::CaseInsensitive)) {
+ return t->symbol;
+ }
+ }
+ return 0;
+}
+
+static const char*
+bushnell_get_name_from_symbol(signed int s)
+{
+ for (const bushnell_icon_mapping_t* t = bushnell_icons; t->icon != nullptr; t++) {
+ if (s == t->symbol) {
+ return t->icon;
+ }
+ }
+ return "Waypoint";
+}
+
+static void
+rd_init(const QString& fname)
+{
+ file_in = gbfopen_le(fname, "rb", MYNAME);
+}
+
+static void
+rd_deinit()
+{
+ gbfclose(file_in);
+}
+
+static void
+wr_init(const QString& fname)
+{
+ static char valid_chars [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789"
+ ".-/\\~@#$%^&*()_+=<>"
+ "abcdefghijklmnopqrstuvwxyz";
+
+ // If user provided an extension in the pathname, whack it.
+ ofname = fname;
+ int suffix_len = QFileInfo(fname).suffix().length();
+ if (suffix_len > 0) {
+ /* drop the suffix and the period */
+ ofname.chop(suffix_len + 1);
+ }
+
+ mkshort_handle = mkshort_new_handle();
+ setshort_length(mkshort_handle, 19);
+ setshort_goodchars(mkshort_handle, valid_chars);
+}
+
+static void
+wr_deinit()
+{
+ mkshort_del_handle(&mkshort_handle);
+ ofname.clear();
+}
+
+/*
+ * Each file contains a single waypoint.
+ */
+static void
+bushnell_read()
+{
+ auto* wpt_tmp = new Waypoint;
+
+ int32_t lat_tmp = gbfgetint32(file_in);
+ int32_t lon_tmp = gbfgetint32(file_in);
+
+ unsigned int icon = gbfgetc(file_in);
+ wpt_tmp->icon_descr = bushnell_get_name_from_symbol(icon);
+ unsigned int proximity = gbfgetc(file_in); // 1 = off, 3 = proximity alarm.
+ (void) proximity;
+ wpt_tmp->latitude = lat_tmp / 10000000.0;
+ wpt_tmp->longitude = lon_tmp / 10000000.0;
+
+ // Apparently this is always zero terminated, though it's never been
+ // observed to be longer than 19 bytes + a null terminator.
+ wpt_tmp->shortname = gbfgetstr(file_in);
+
+ waypt_add(wpt_tmp);
+}
+
+static void
+bushnell_write_one(const Waypoint* wpt)
+{
+ char tbuf[20]; // 19 text bytes + null terminator.
+ char padding[2] = {0, 0};
+ static int wpt_count;
+ QString fname(ofname);
+ fname += "-";
+ fname += QString::number(wpt_count++);
+ fname += ".wpt";
+
+ gbfile* file_out = gbfopen_le(fname, "wb", MYNAME);
+ gbfputint32(round(wpt->latitude * 10000000), file_out);
+ gbfputint32(round(wpt->longitude * 10000000), file_out);
+ gbfputc(bushnell_get_icon_from_name(wpt->icon_descr), file_out);
+ gbfputc(0x01, file_out); // Proximity alarm. 1 == "off", 3 == armed.
+
+ strncpy(tbuf, CSTRc(wpt->shortname), sizeof(tbuf) - 1);
+ tbuf[sizeof(tbuf)-1] = 0;
+ gbfwrite(tbuf, sizeof(tbuf), 1, file_out);
+
+ // two padding bytes follow name.
+ gbfwrite(padding, sizeof(padding), 1, file_out);
+
+ gbfclose(file_out);
+}
+
+static void
+bushnell_write()
+{
+ waypt_disp_all(bushnell_write_one);
+}
+
+ff_vecs_t bushnell_vecs = {
+ ff_type_file,
+ FF_CAP_RW_WPT,
+ rd_init,
+ wr_init,
+ rd_deinit,
+ wr_deinit,
+ bushnell_read,
+ bushnell_write,
+ nullptr,
+ &bushnell_args,
+ CET_CHARSET_MS_ANSI, 0, /* Not really sure... */
+ NULL_POS_OPS,
+ nullptr
+};
--- /dev/null
+/*
+ Read and write Bushnell trail *.trl files.
+
+ Copyright (C) 2009 Robert Lipe (robertlipe+source@gpsbabel.org)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ */
+
+
+#include "defs.h"
+#define MYNAME "Bushnell Trail"
+
+static gbfile* file_in;
+static gbfile* file_out;
+static int trkpt_count;
+static route_head* trk_head;
+
+static
+QVector<arglist_t> bushnell_args = {
+};
+
+static void
+rd_init(const QString& fname)
+{
+ char h[0x14]; // Believed to be zero terminated.
+ file_in = gbfopen_le(fname, "rb", MYNAME);
+ gbfread(h, 1, sizeof(h), file_in);
+
+ trk_head = new route_head;
+ track_add_head(trk_head);
+
+ trk_head->rte_name = lrtrim(h);
+}
+
+static void
+rd_deinit()
+{
+ gbfclose(file_in);
+}
+
+static void
+wr_init(const QString& fname)
+{
+ int l = fname.length();
+ char obuf[20] = { 0 } ;
+ char* p = obuf;
+ file_out = gbfopen_le(fname, "w", MYNAME);
+ trkpt_count = 0;
+ QString fnameu = fname.toUpper();
+ for (int i = 0; (i < l) && (i < 20); i++) {
+ char c = fnameu[i].toLatin1();
+ if (isalnum(c)) {
+ *p++ = c;
+ }
+ if (c == '.') {
+ break;
+ }
+ }
+ gbfwrite(&obuf, 1, 20, file_out);
+}
+
+static void
+wr_deinit()
+{
+ int i = trkpt_count;
+ while (i < 4502) {
+ gbfputint32(0, file_out);
+ gbfputint32(0, file_out);
+ i++;
+ }
+ gbfputint32(0, file_out);
+ gbfputint16(trkpt_count, file_out);
+ gbfputc(1, file_out);
+
+ gbfclose(file_out);
+}
+
+/*
+ * Each file contains a single waypoint.
+ */
+static void
+bushnell_read()
+{
+ while (true) {
+ int lat_tmp = gbfgetint32(file_in);
+ int lon_tmp = gbfgetint32(file_in);
+
+ if (!lat_tmp && !lon_tmp) {
+ break;
+ }
+
+ auto* wpt_tmp = new Waypoint;
+ wpt_tmp->latitude = lat_tmp / 10000000.0;
+ wpt_tmp->longitude = lon_tmp / 10000000.0;
+
+ track_add_wpt(trk_head, wpt_tmp);
+ }
+}
+
+static void
+bushnell_write_one(const Waypoint* wpt)
+{
+ int32_t lat = wpt->latitude * 10000000.0;
+ int32_t lon = wpt->longitude * 10000000.0;
+ trkpt_count++;
+ if (trkpt_count > 4502) {
+ fatal(MYNAME " too many trackpoints. Max is 4502.");
+ }
+
+ gbfputint32(lat, file_out);
+ gbfputint32(lon, file_out);
+}
+
+static void
+bushnell_write()
+{
+ track_disp_all(nullptr, nullptr, bushnell_write_one);
+}
+
+ff_vecs_t bushnell_trl_vecs = {
+ ff_type_file,
+ { ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none },
+ rd_init,
+ wr_init,
+ rd_deinit,
+ wr_deinit,
+ bushnell_read,
+ bushnell_write,
+ nullptr,
+ &bushnell_args,
+ CET_CHARSET_MS_ANSI, 0, /* Not really sure... */
+ NULL_POS_OPS,
+ nullptr
+};
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<gpx version="1.0" creator="GPSBabel - https://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/0">
- <time>1970-01-01T00:00:00Z</time>
- <bounds minlat="55.296300000" minlon="-133.243100000" maxlat="55.296300000" maxlon="-133.243100000"/>
- <wpt lat="55.296300000" lon="-133.243100000">
- <name>Waterfall Resort</name>
- <cmt>Waterfall Resort</cmt>
- <desc>Waterfall Resort</desc>
- <sym>Fishing</sym>
- </wpt>
-</gpx>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<gpx version="1.0" creator="GPSBabel - https://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/0">
- <time>1970-01-01T00:00:00Z</time>
- <bounds minlat="35.260533000" minlon="-92.445088000" maxlat="35.262290000" maxlon="-92.441453000"/>
- <trk>
- <name>TL003</name>
- <trkseg>
- <trkpt lat="35.261709000" lon="-92.443509000"/>
- <trkpt lat="35.261667000" lon="-92.443418000"/>
- <trkpt lat="35.261610000" lon="-92.443339000"/>
- <trkpt lat="35.261577000" lon="-92.443256000"/>
- <trkpt lat="35.261552000" lon="-92.443173000"/>
- <trkpt lat="35.261513000" lon="-92.443082000"/>
- <trkpt lat="35.261453000" lon="-92.443025000"/>
- <trkpt lat="35.261385000" lon="-92.443003000"/>
- <trkpt lat="35.261315000" lon="-92.443010000"/>
- <trkpt lat="35.261255000" lon="-92.442955000"/>
- <trkpt lat="35.261254000" lon="-92.442859000"/>
- <trkpt lat="35.261214000" lon="-92.442770000"/>
- <trkpt lat="35.261208000" lon="-92.442667000"/>
- <trkpt lat="35.261196000" lon="-92.442572000"/>
- <trkpt lat="35.261181000" lon="-92.442473000"/>
- <trkpt lat="35.261179000" lon="-92.442373000"/>
- <trkpt lat="35.261199000" lon="-92.442274000"/>
- <trkpt lat="35.261211000" lon="-92.442174000"/>
- <trkpt lat="35.261215000" lon="-92.442087000"/>
- <trkpt lat="35.261194000" lon="-92.442006000"/>
- <trkpt lat="35.261150000" lon="-92.441934000"/>
- <trkpt lat="35.261081000" lon="-92.441889000"/>
- <trkpt lat="35.261033000" lon="-92.441810000"/>
- <trkpt lat="35.261026000" lon="-92.441726000"/>
- <trkpt lat="35.261032000" lon="-92.441625000"/>
- <trkpt lat="35.261049000" lon="-92.441529000"/>
- <trkpt lat="35.261135000" lon="-92.441504000"/>
- <trkpt lat="35.261207000" lon="-92.441549000"/>
- <trkpt lat="35.261273000" lon="-92.441500000"/>
- <trkpt lat="35.261348000" lon="-92.441487000"/>
- <trkpt lat="35.261417000" lon="-92.441472000"/>
- <trkpt lat="35.261501000" lon="-92.441469000"/>
- <trkpt lat="35.261581000" lon="-92.441475000"/>
- <trkpt lat="35.261654000" lon="-92.441467000"/>
- <trkpt lat="35.261729000" lon="-92.441464000"/>
- <trkpt lat="35.261814000" lon="-92.441463000"/>
- <trkpt lat="35.261890000" lon="-92.441468000"/>
- <trkpt lat="35.261978000" lon="-92.441458000"/>
- <trkpt lat="35.262051000" lon="-92.441459000"/>
- <trkpt lat="35.262125000" lon="-92.441453000"/>
- <trkpt lat="35.262127000" lon="-92.441542000"/>
- <trkpt lat="35.262140000" lon="-92.441638000"/>
- <trkpt lat="35.262140000" lon="-92.441735000"/>
- <trkpt lat="35.262129000" lon="-92.441829000"/>
- <trkpt lat="35.262151000" lon="-92.441914000"/>
- <trkpt lat="35.262146000" lon="-92.442013000"/>
- <trkpt lat="35.262152000" lon="-92.442112000"/>
- <trkpt lat="35.262132000" lon="-92.442206000"/>
- <trkpt lat="35.262108000" lon="-92.442312000"/>
- <trkpt lat="35.262086000" lon="-92.442395000"/>
- <trkpt lat="35.262109000" lon="-92.442491000"/>
- <trkpt lat="35.262125000" lon="-92.442582000"/>
- <trkpt lat="35.262131000" lon="-92.442665000"/>
- <trkpt lat="35.262143000" lon="-92.442747000"/>
- <trkpt lat="35.262120000" lon="-92.442828000"/>
- <trkpt lat="35.262117000" lon="-92.442923000"/>
- <trkpt lat="35.262130000" lon="-92.443019000"/>
- <trkpt lat="35.262147000" lon="-92.443100000"/>
- <trkpt lat="35.262151000" lon="-92.443208000"/>
- <trkpt lat="35.262152000" lon="-92.443308000"/>
- <trkpt lat="35.262186000" lon="-92.443382000"/>
- <trkpt lat="35.262215000" lon="-92.443476000"/>
- <trkpt lat="35.262223000" lon="-92.443561000"/>
- <trkpt lat="35.262223000" lon="-92.443663000"/>
- <trkpt lat="35.262229000" lon="-92.443765000"/>
- <trkpt lat="35.262221000" lon="-92.443851000"/>
- <trkpt lat="35.262203000" lon="-92.443942000"/>
- <trkpt lat="35.262159000" lon="-92.444015000"/>
- <trkpt lat="35.262152000" lon="-92.444100000"/>
- <trkpt lat="35.262220000" lon="-92.444138000"/>
- <trkpt lat="35.262206000" lon="-92.444221000"/>
- <trkpt lat="35.262148000" lon="-92.444289000"/>
- <trkpt lat="35.262137000" lon="-92.444383000"/>
- <trkpt lat="35.262176000" lon="-92.444456000"/>
- <trkpt lat="35.262185000" lon="-92.444554000"/>
- <trkpt lat="35.262197000" lon="-92.444642000"/>
- <trkpt lat="35.262249000" lon="-92.444705000"/>
- <trkpt lat="35.262242000" lon="-92.444790000"/>
- <trkpt lat="35.262240000" lon="-92.444885000"/>
- <trkpt lat="35.262264000" lon="-92.444964000"/>
- <trkpt lat="35.262290000" lon="-92.445042000"/>
- <trkpt lat="35.262232000" lon="-92.444983000"/>
- <trkpt lat="35.262171000" lon="-92.444922000"/>
- <trkpt lat="35.262099000" lon="-92.444908000"/>
- <trkpt lat="35.262027000" lon="-92.444945000"/>
- <trkpt lat="35.261995000" lon="-92.445019000"/>
- <trkpt lat="35.261932000" lon="-92.445058000"/>
- <trkpt lat="35.261853000" lon="-92.445069000"/>
- <trkpt lat="35.261768000" lon="-92.445063000"/>
- <trkpt lat="35.261694000" lon="-92.445056000"/>
- <trkpt lat="35.261618000" lon="-92.445029000"/>
- <trkpt lat="35.261548000" lon="-92.445018000"/>
- <trkpt lat="35.261462000" lon="-92.445020000"/>
- <trkpt lat="35.261403000" lon="-92.445061000"/>
- <trkpt lat="35.261327000" lon="-92.445064000"/>
- <trkpt lat="35.261234000" lon="-92.445069000"/>
- <trkpt lat="35.261160000" lon="-92.445071000"/>
- <trkpt lat="35.261077000" lon="-92.445074000"/>
- <trkpt lat="35.260999000" lon="-92.445072000"/>
- <trkpt lat="35.260930000" lon="-92.445059000"/>
- <trkpt lat="35.260851000" lon="-92.445088000"/>
- <trkpt lat="35.260828000" lon="-92.445003000"/>
- <trkpt lat="35.260774000" lon="-92.444931000"/>
- <trkpt lat="35.260729000" lon="-92.444833000"/>
- <trkpt lat="35.260689000" lon="-92.444732000"/>
- <trkpt lat="35.260665000" lon="-92.444654000"/>
- <trkpt lat="35.260629000" lon="-92.444558000"/>
- <trkpt lat="35.260581000" lon="-92.444486000"/>
- <trkpt lat="35.260533000" lon="-92.444413000"/>
- <trkpt lat="35.260563000" lon="-92.444334000"/>
- <trkpt lat="35.260622000" lon="-92.444266000"/>
- <trkpt lat="35.260691000" lon="-92.444239000"/>
- <trkpt lat="35.260761000" lon="-92.444211000"/>
- <trkpt lat="35.260835000" lon="-92.444178000"/>
- <trkpt lat="35.260906000" lon="-92.444133000"/>
- <trkpt lat="35.260974000" lon="-92.444095000"/>
- <trkpt lat="35.261042000" lon="-92.444064000"/>
- <trkpt lat="35.261114000" lon="-92.444015000"/>
- <trkpt lat="35.261188000" lon="-92.444011000"/>
- </trkseg>
- </trk>
-</gpx>
baroiq Brauniger IQ Series Barograph Download
-bushnell_trl trl Bushnell GPS Trail file
-bushnell wpt Bushnell GPS Waypoint file
cambridge dat Cambridge/Winpilot glider software
cst cst CarteSurTable data file
v900 Columbus/Visiontac V900 files (.csv)
internal xcsv ? Character Separated Values
internal tabsep All database fields on one tab-separated line
serial baroiq Brauniger IQ Series Barograph Download
-file bushnell_trl trl Bushnell GPS Trail file
-file bushnell wpt Bushnell GPS Waypoint file
file cambridge dat Cambridge/Winpilot glider software
file cst cst CarteSurTable data file
file v900 Columbus/Visiontac V900 files (.csv)
internal rw---- xcsv ? Character Separated Values
internal rw---- tabsep All database fields on one tab-separated line
serial --r--- baroiq Brauniger IQ Series Barograph Download
-file --rw-- bushnell_trl trl Bushnell GPS Trail file
-file rw---- bushnell wpt Bushnell GPS Waypoint file
file rw---- cambridge dat Cambridge/Winpilot glider software
file r-r-r- cst cst CarteSurTable data file
file r-r--- v900 Columbus/Visiontac V900 files (.csv)
serial --r--- baroiq Brauniger IQ Series Barograph Download baroiq
https://www.gpsbabel.org/WEB_DOC_DIR/fmt_baroiq.html
-file --rw-- bushnell_trl trl Bushnell GPS Trail file bushnell_trl
- https://www.gpsbabel.org/WEB_DOC_DIR/fmt_bushnell_trl.html
-file rw---- bushnell wpt Bushnell GPS Waypoint file bushnell
- https://www.gpsbabel.org/WEB_DOC_DIR/fmt_bushnell.html
file rw---- cambridge dat Cambridge/Winpilot glider software xcsv
https://www.gpsbabel.org/WEB_DOC_DIR/fmt_cambridge.html
option cambridge snlen Max synthesized shortname length integer 1 https://www.gpsbabel.org/WEB_DOC_DIR/fmt_cambridge.html#fmt_cambridge_o_snlen
File Types (-i and -o options):
baroiq Brauniger IQ Series Barograph Download
- bushnell_trl Bushnell GPS Trail file
- bushnell Bushnell GPS Waypoint file
cambridge Cambridge/Winpilot glider software
snlen Max synthesized shortname length
snwhite (0/1) Allow whitespace synth. shortnames
+++ /dev/null
-rm -f ${TMPDIR}/bushnell.*
-gpsbabel -i bushnell -f ${REFERENCE}/bushnell.wpt -o gpx -F ${TMPDIR}/bushnell.gpx
-compare ${REFERENCE}/bushnell.gpx ${TMPDIR}/bushnell.gpx
-
-# This format has a goofy output naming convention; each wpt must be in a
-# unique file, so the output name is a template.
-gpsbabel -i bushnell -f ${REFERENCE}/bushnell.wpt -o bushnell -F ${TMPDIR}/bushnell
-bincompare ${REFERENCE}/bushnell.wpt ${TMPDIR}/bushnell-0.wpt
-
-gpsbabel -i bushnell_trl -f ${REFERENCE}/bushnell_trl.trl -o gpx -F ${TMPDIR}/bushnell_trl.gpx -o bushnell_trl -F ${TMPDIR}/bush_trl.trl
-compare ${REFERENCE}/bushnell_trl.gpx ${TMPDIR}/bushnell_trl.gpx
-
-# Because of numeric instability, we don't actually do the compare, but there's
-# value just in spinning through the writer.
-gpsbabel -i bushnell_trl -f ${TMPDIR}/bush_trl.trl -o gpx -F ${TMPDIR}/bush~gpx.gpx
-# compare ${REFERENCE}/bushnell_trl.gpx ${TMPDIR}/bush~gpx.gpx
--- /dev/null
+rm -f ${TMPDIR}/bushnell.*
+gpsbabel -i bushnell -f ${REFERENCE}/bushnell.wpt -o gpx -F ${TMPDIR}/bushnell.gpx
+compare ${REFERENCE}/bushnell.gpx ${TMPDIR}/bushnell.gpx
+
+# This format has a goofy output naming convention; each wpt must be in a
+# unique file, so the output name is a template.
+gpsbabel -i bushnell -f ${REFERENCE}/bushnell.wpt -o bushnell -F ${TMPDIR}/bushnell
+bincompare ${REFERENCE}/bushnell.wpt ${TMPDIR}/bushnell-0.wpt
+
+gpsbabel -i bushnell_trl -f ${REFERENCE}/bushnell_trl.trl -o gpx -F ${TMPDIR}/bushnell_trl.gpx -o bushnell_trl -F ${TMPDIR}/bush_trl.trl
+compare ${REFERENCE}/bushnell_trl.gpx ${TMPDIR}/bushnell_trl.gpx
+
+# Because of numeric instability, we don't actually do the compare, but there's
+# value just in spinning through the writer.
+gpsbabel -i bushnell_trl -f ${TMPDIR}/bush_trl.trl -o gpx -F ${TMPDIR}/bush~gpx.gpx
+# compare ${REFERENCE}/bushnell_trl.gpx ${TMPDIR}/bush~gpx.gpx
extern ff_vecs_t sbp_vecs;
extern ff_vecs_t sbn_vecs;
extern ff_vecs_t mmo_vecs;
-extern ff_vecs_t bushnell_vecs;
-extern ff_vecs_t bushnell_trl_vecs;
extern ff_vecs_t skyforce_vecs;
extern ff_vecs_t pocketfms_bc_vecs;
extern ff_vecs_t pocketfms_fp_vecs;
LegacyFormat sbp_fmt {sbp_vecs};
LegacyFormat sbn_fmt {sbn_vecs};
LegacyFormat mmo_fmt {mmo_vecs};
- LegacyFormat bushnell_fmt {bushnell_vecs};
- LegacyFormat bushnell_trl_fmt {bushnell_trl_vecs};
LegacyFormat skyforce_fmt {skyforce_vecs};
LegacyFormat pocketfms_bc_fmt {pocketfms_bc_vecs};
LegacyFormat pocketfms_fp_fmt {pocketfms_fp_vecs};
"mmo",
nullptr,
},
- {
- &bushnell_fmt,
- "bushnell",
- "Bushnell GPS Waypoint file",
- "wpt",
- nullptr,
- },
- {
- &bushnell_trl_fmt,
- "bushnell_trl",
- "Bushnell GPS Trail file",
- "trl",
- nullptr,
- },
{
&skyforce_fmt,
"skyforce",